package com.irdstudio.tdp.console.api.rest;

import java.util.List;

import com.irdstudio.sdk.beans.core.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.irdstudio.tdp.console.service.facade.IsrvCondInfoService;
import com.irdstudio.tdp.console.service.vo.IsrvCondInfoVO;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.ssm.web.AbstractController;

@RestController
@RequestMapping("/api")
public class IsrvCondInfoController extends AbstractController  {
	
	@Autowired
	@Qualifier("isrvCondInfoServiceImpl")
	private IsrvCondInfoService isrvCondInfoService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/isrv/cond/infos", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<IsrvCondInfoVO>> queryIsrvCondInfoAll(
			IsrvCondInfoVO vo) {		
		List<IsrvCondInfoVO> outputVo = isrvCondInfoService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/isrv/cond/info/{condId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<IsrvCondInfoVO> queryByPk(@PathVariable("condId") String condId) {		
		IsrvCondInfoVO inVo = new IsrvCondInfoVO();
				inVo.setCondId(condId);
		IsrvCondInfoVO outputVo = isrvCondInfoService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param isrvCondInfo
	 * @return
	 */
	@RequestMapping(value="/isrv/cond/info", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody IsrvCondInfoVO inIsrvCondInfoVo) {		
		int outputVo = isrvCondInfoService.deleteByPk(inIsrvCondInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inIsrvCondInfoVo
	 * @return
	 */
	@RequestMapping(value="/isrv/cond/info", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody IsrvCondInfoVO inIsrvCondInfoVo) {		
		int outputVo = isrvCondInfoService.updateByPk(inIsrvCondInfoVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inIsrvCondInfoVo
	 * @return
	 */
	@RequestMapping(value="/isrv/cond/info", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertIsrvCondInfo(@RequestBody IsrvCondInfoVO inIsrvCondInfoVo) {
		inIsrvCondInfoVo.setCondId(UUIDUtil.getUUID());
		int outputVo = isrvCondInfoService.insertIsrvCondInfo(inIsrvCondInfoVo);
		return getResponseData(outputVo);
		
	}
}
